// 横版
export function setHtml(data, flag,isShowLost,isShowMainProduct) {
  let html = "";
  let str = flag ? "crossA4List" : "verticalA4List";
  // 表头
  html +=
    "<table style='width: 100%;border-collapse: collapse;'>" +
    "<tbody>" +
    "<tr>" +
    "<th style='border: 1px solid #ccc;background: red!important;' colSpan='1' rowSpan='1' width='auto'>序号</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>商品名称</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>品牌</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>型号</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>单位</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>数量</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>耗损率</th>"
  if (isShowLost === 1) {
    html += "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>耗损率</th>";
  }
  if (isShowMainProduct === 1) {
    html += "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>主材</th>";
  }

  if (data[str].find(item => item.coloumFields === "mainPicUrl").val === 1) {
    html += "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>图片1</th>";
  }
  if (data[str].find(item => item.coloumFields === "productUnitPrice").val === 1) {
    html += "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>材料单价</th>";
  }
  if (data[str].find(item => item.coloumFields === "workerUnitPrice").val === 1) {
    html += "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>人工费单价</th>";
  }
  if (data[str].find(item => item.coloumFields === "unitTotalMoney").val === 1) {
    html += "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>单项合计</th>";
  }
  if (data[str].find(item => item.coloumFields === "projectTotalMoney").val === 1) {
    html += "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>汇总合计</th>";
  }
  html +=
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>预算工程量</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>材料及工艺说明</th>" +
    "<th style='border: 1px solid #ccc;background: #f5f2f0;' colSpan='1' rowSpan='1' width='auto'>备注</th>";
  html += "</tr></tbody></table><br>";
  return html;
}
